package leetcode2;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;

public class Day11 {
    public String makeSmallestPalindrome(String s) {
        int n = s.length();
        int target = 0;
        if(n%2!=0) target=1;
        char[] ss = s.toCharArray();
        int left=0,right=n-1;
        while(left < right) {
            if(ss[left] < ss[right]) {
                ss[right] = ss[left];
            }else if(ss[left] > ss[right]){
                ss[left] = ss[right];
            }
            left++;
            right--;
        }
        return new String(ss);

    }


    //二叉树前序遍历
   /* public List<Integer> preorderTraversal(TreeNode root) {
        List<Integer> ret = new ArrayList<>();
        Stack<TreeNode> stack = new Stack<>();
        TreeNode cur = root;
        while(cur != null || !stack.isEmpty()) {
            while(cur != null) { //不断往中左遍历
                stack.push(cur);
                ret.add(cur.val);
                cur = cur.left;
            }
            //开始遍历右树
            TreeNode top = stack.pop();
            cur = top.right;
        }
        return ret;
    }*/

}
